home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.cyberramp.net!news
- From: sinan@cyberramp.net (John Noland)
- Newsgroups: comp.lang.misc,comp.lang.c,comp.lang.pl1
- Subject: Re: GOTO controversy
- Date: 7 Mar 1996 21:23:02 GMT
- Organization: Prose Software
- Message-ID: <4hnk3m$jbb@newshost.cyberramp.net>
- References: <rcshlds.1.000A6705@mailserv.mta.ca> <Dn8pJ8.nqs@emi.net> <4grt4e$8fg@goanna.cs.rmit.EDU.AU> <4hl8mt$4po@newshost.cyberramp.net> <wallaceDnvoEo.7L7@netcom.com>
- NNTP-Posting-Host: ramp2-13.cyberramp.net
- X-Newsreader: WinVN 0.99.5
-
- In article <wallaceDnvoEo.7L7@netcom.com>, wallace@netcom.com says...
- >
- >Ok, I'll bite: why is a subroutine with multiple gotos to a single exit point
- >a "lot" easier to maintain than that same routine with multiple returns?
- >
- >The only maintenance tasks that I can see that get any easier are inserting
- >special-purpose cleanup code that must run before a given function returns
- >(regardless of why it is returning)
-
- This was what I had in mind when I wrote that. I probably should have provided
- an example and said that in THIS particular situation a goto to a single exit
- point is much preferable to multiple return statements.
-
- I did a grep on all of my C source files for the accounting system I work
- on and found only 3 goto's in 250,000+ lines of code. So, if you were to take
- these guidelines as hard and fast rules as to when to USE goto, well, then, I
- obviously don't follow them very well myself.
-
- Sorry all, in retrospect I didn't do very well in presenting my views. Please
- forgive me!
-
- -John
-
-